﻿<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <link href="../Plugins/jquery-ui/jquery-ui.min.css" rel="stylesheet" />
    <link href="../zui/lib/bootstrap/css/bootstrap.css" rel="stylesheet" />
    <link href="../Plugins/pinyin/simple-input-method.css" rel="stylesheet" />
    <link href="../zui/css/font-awesome.min.css" rel="stylesheet" />
    <link href="../zui/css/zui.min.css" rel="stylesheet" />
    <link href="../zui/lib/layer/skin/default/layer.css" rel="stylesheet" />
    <link href="../zui/lib/swiper/css/swiper.min.css" rel="stylesheet" />
    <link href="../Plugins/sweetalert/sweetalert.css" rel="stylesheet" />
    <link href="../Plugins/jquery-step/jquery.steps.css" rel="stylesheet" />
    <link href="../zui/css/app.css" rel="stylesheet" />
    <title></title>
    <style type="text/css">
        .form-control {
            height: 40px;
            line-height: 40px;
            font-size: 16px !important;
            padding-left: 10px !important;
        }

        .btn {
            height: 40px;
            font-size: 15px !important;
        }

        body {
            font-size: 16px !important;
        }
    </style>
</head>
<body>
    <div class="container" style="padding-left:0px !important;max-width:870px!important; width:870px">
        <div class="row" style="margin-bottom:10px;">
            <div class="col-md-6">
                <div class="input-group">
                    <div class="input-control search-box search-box-circle has-icon-left has-icon-right search-example" id="searchboxExample">
                        <input id="inputSearchExample3" type="search" class="form-control search-input numkeyboard" placeholder="搜索">
                    </div>
                    <span class="input-group-btn">
                        <button class="btn btn-primary" id="search-btn" type="button">搜索</button>
                    </span>
                </div>
            </div>

        </div>
        <div style="height:280px !important; overflow-y:scroll">
            <table class="table table-bordered">
                <thead>
                    <tr>
                        <th style="text-align: center">账号</th>
                        <th style="text-align: center">姓名</th>
                        <th style="text-align: center">性别</th>
                        <th style="text-align: center">角色</th>
                        <th style="text-align: center">操作</th>
                    </tr>
                </thead>
                <tbody>
                    <!--<tr>
                    <td>admin</td>
                    <td>李新波</td>
                    <td>男</td>
                    <td>管理员</td>
                    <td><a id="view" href="javascript:void(0)">修改</a>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <a id="deleteUser" href=" javascript:void(0)">删除</a></td>

                </tr>
                <tr>
                    <td>guest</td>
                    <td>guest</td>
                    <td>男</td>
                    <td>普通用户</td>
                    <td><a id="view" href=" javascript:void(0)">修改</a>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <a id="deleteUser" href=" javascript:void(0)">删除</a></td>
                </tr>-->

                </tbody>

            </table>
        </div>
        <div class="shiyan-footer" style="position:fixed; bottom:0px">
            <button style="height:50px;float:left;margin-right:5px;" class="btn btn-default btn-lg home-btn" type="button">返回主菜单</button>

            <button style="height:50px;float:right" class="btn btn-primary btn-lg start-shiyan" id="adduser-btn" type="button">新增用户</button>
        </div>
    </div>
    <script src="../zui/lib/jquery/jquery.js"></script>
    <script src="../Plugins/jquery-ui/jquery-ui.min.js"></script>
    <script src="../zui/lib/bootstrap/js/bootstrap.min.js"></script>
    <script src="../zui/lib/layer/layer.js"></script>
    <script src="../Plugins/sweetalert/sweetalert.min.js"></script>
    <script src="../zui/lib/swiper/js/swiper.min.js"></script>
    <script src="../Plugins/sweetalert/sweetalert.min.js"></script>
    <script src="../Plugins/jquery-step/jquery.steps.min.js"></script>
    <script src="../static/jquery.flot.js"></script>
    <script src="../zui/js/utils.js"></script>
    <script src="../zui/js/app.js"></script>
    <script type="text/javascript">

        $(function () {
            AjaxGet("正在获取列表数据...", "getUserList",
                {
                    searchValue: ''
                }, function (res) {
                    var uList = JSON.parse(res).data;
                    bindList(uList);
                });

            //返回菜单页按钮事件
            $(".home-btn").click(function () {
                $("#content-frame", parent.document).attr("src", "Menu.html");
                $("#menu-title", parent.document).removeClass().addClass("fa fa-home").text(" 功能菜单");
                $("#userinfo-btn", parent.document).removeClass("disabled");

            });
            $("#adduser-btn").click(function () {

                location.href = "AddUser.html?userId=0";
            });

            $("#search-btn").click(function () {
                var uList = JSON.parse(top.dataOpera.getUserList($(".search-input").val())).data;
                bindList(uList);
            });

        })
        function getRoleType(type) {
            if (type == 1) {
                return "管理员";
            }
            else if (type == 2) {
                return "普通用户";
            }
        }

        function bindList(uList) {
            var uStr = "";
           $(uList).each(function (index, el) {
                uStr += '<tr style="text-align: center"><td style="line-height: 40px;">' + uList[index].user_name + '</td>';
                uStr += '<td style="line-height: 40px;">' + uList[index].real_name + '</td>';
                uStr += '<td style="line-height: 40px;">' + (uList[index].user_sex == 0 ? "女" : "男") + '</td>';
                uStr += '<td style="line-height: 40px;">' + getRoleType(uList[index].user_role) + '</td>';
                uStr += '<td><button  style="height: 40px!important ;line-height: 15px!important;width: 80px!important;" class="btn btn-default view"  val="' + uList[index].user_id + '" type="button">编辑</button></td></tr>';

            })
            $(".table tbody").html(uStr);
            $(".view").click(function () {
                location.href = "AddUser.html?userId=" + $(this).attr("val");
            });
        }

    </script>
</body>
</html>